Skip to content

macOS: do not call fuse_session_fd before fuse_daemonise#374

Open
dmik wants to merge 1 commit into
libfuse:masterfrom
dmik:master
Open

macOS: do not call fuse_session_fd before fuse_daemonise#374
dmik wants to merge 1 commit into
libfuse:masterfrom
dmik:master

Conversation

@dmik

@dmik dmik commented Jul 6, 2026

Copy link
Copy Markdown

This appears to be the right sequence and also fixes ObjC/fork issues on macOS with macFUSE 5.2.0+ (see #373).

@bfleischer

Copy link
Copy Markdown
Collaborator

Please see my comment #373 (comment)

Comment thread sshfs.c
}

#if !defined(__CYGWIN__)
res = fcntl(fuse_session_fd(se), F_SETFD, FD_CLOEXEC);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line forces macFUSE 5.3.3 and later to materialize the delayed mount. Starting with macFUSE 5.3.3, fuse_daemonize() will no longer perform the fork(), after the mount has been materialized.

This prevents forking on macFUSE 5.3.3+ so that sshfs continues to run in foreground.
According to macFUSE maintainer, this call is not needed with recent macFUSE at all.

See libfuse#373 for more info.
@dmik dmik changed the title call fuse_daemonize before fuse_mount macOS: do not call fuse_session_fd before fuse_daemonise Jul 7, 2026
@dmik

dmik commented Jul 7, 2026

Copy link
Copy Markdown
Author

Please also back port it to the 2.x branch. I tested the patch locally and it works well with macFUSE 5.3.3.

It's also worth removing this from sshfs.c in the 2.x branch:

#ifdef __APPLE__
#  include <fuse_darwin.h>
#endif

as macFUSE 5.x doesn't have it (and doesn't need it).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants